<?php
class Controller_App_Comments extends Controller_App_Template
{
    public function __construct ($req, $res)
    {
        $this->template = "smarty:app/comments";
        parent::__construct($req, $res);
    }

    // 
    public function action_gonglue ($nid, $page)
    {
        if (! empty($_POST))
        {
            print_r($_POST);exit;
        }
        $limit  = 10;
        $offset = (max($page, 1) - 1) * $limit;
        list($total, $items) = App_Comments::items('gonglue', $nid, $offset, $limit);

        $this->template->set('title', '评论');
        $this->template->set('comments', array(
            'total' => $total,
            'items' => $items,
        ));
    }
}
